package com.kingsoft.dc.khaos.ui

import com.kingsoft.dc.khaos.ui.JobExecutionStatus.JobExecutionStatus

import scala.collection.mutable


/**
  * Created by chengguangqing on 2019/5/28.
  */
object UIData {

  class ApplicationUIData
  (
    var applicationId:Int = -1,
    var jobIds:Seq[String] = Seq.empty,
    var submissionTime:Option[Long] = None,
    var completionTime:Option[Long] =None,
    var status:JobExecutionStatus = JobExecutionStatus.UNKNOWN,
    var numJobs:Int = 0,
    var numActiveJobs:Int = 0,
    var numberCompletedJobs:Int = 0,
    var numFailedJobs:Int = 0
  )

  class JobUIData
  (
    var jobId:Int = -1,
    var submissionTime:Option[Long]=None,
    var completionTime:Option[Long]=None,
    var status: JobExecutionStatus = JobExecutionStatus.UNKNOWN,
    var taskIds: List[Int] = List.empty,
    //与spark不同的是，这里面的numTask的含义是一个job对应多少个需要执行的组件
    var numTasks: Int = 0,
    var numActiveTasks: Int = 0,
    var numCompletedTasks: Int = 0,
    var numFailedTasks: Int = 0,
    var completedStageIndices: mutable.HashSet[Int] = mutable.HashSet[Int]()
  )

  class TaskUIData {
    var numTasks: Int = 0
    var numActiveTasks: Int = 0
    var numCompletedTasks: Int = 0
    var numFailedTasks: Int = 0
  }
}

